import os
from shutil import copy



ann_filepath = '/home/lixu/PycharmProjects/TrainModelUtils/BDD100kutils/Annotations'
img_filepath = '/home/lixu/PycharmProjects/TrainModelUtils/BDD100kutils/JPEGImages'
img_savepath = 'BDD100kutils/car1'
ann_savepath = 'BDD100kutils/carl1/'

annotation_names=[os.path.join(ann_filepath,i) for i in os.listdir(ann_filepath)]


count=0
for file in annotation_names:
    if count>=52500and count<70000:
        jpgname=file.split(".")[-2]
        jpgname=jpgname.split('/')[-1]
        jpg_path=img_filepath+'/'+jpgname+'.jpg'
        xml_path=file
        copy(jpg_path,img_savepath)
        copy(xml_path,ann_savepath)
    count+=1


